//
//  YeeKindPrimaryTableView.m
//  YeeShopProject
//
//  Created by CoderYee on 2017/2/28.
//  Copyright © 2017年 CoderYee. All rights reserved.
//

#import "YeeKindPrimaryTableView.h"
@interface YeePrimaryTableViewCell : UITableViewCell
@property(nonatomic,retain)UILabel    *describeLable;
@property(nonatomic,retain)UIView     *lineView;

@end

@implementation YeePrimaryTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        [self addOwnViews];
    }
    return self;
}
-(void)addOwnViews
{
    _describeLable=[[UILabel alloc] init];
    _describeLable.font=[UIFont Y_systemFontOfSize:13];
    _describeLable.text=@"男士袜子";
    _describeLable.textAlignment=NSTextAlignmentCenter;
    _describeLable.textColor=kBlackColor;
    [self.contentView addSubview:_describeLable];
    [_describeLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.contentView);
        make.height.mas_equalTo(21);
    }];
    _lineView=[[UIView alloc] init];
    [_lineView setBackgroundColor:kNavBarThemeColor];
    [self.contentView addSubview:_lineView];
    
    [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(2.0f);
        make.top.bottom.left.equalTo(self.contentView);
    }];
    
}
@end

@interface YeeKindPrimaryTableView()<UITableViewDelegate,UITableViewDataSource>
{
    
    
}
@end
@implementation YeeKindPrimaryTableView

-(instancetype)initWithFrame:(CGRect)frame
{
    if (self=[super initWithFrame:frame])
    {
        [self addTableView];
    }
    return self;
}
-(void)addTableView
{
    _tableView=[[UITableView alloc] initWithFrame:self.bounds style:UITableViewStyleGrouped];
    _tableView.separatorColor=[UIColor clearColor];
    [_tableView setBackgroundColor:[UIColor clearColor]];
    _tableView.delegate=self;
    _tableView.dataSource=self;
    _tableView.showsVerticalScrollIndicator=NO;
    _tableView.showsHorizontalScrollIndicator=NO;
    [self addSubview:_tableView];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 20;
    
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    YeePrimaryTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:NSStringFromClass([YeePrimaryTableViewCell class])];
    if (cell==nil)
    {
        cell=[[YeePrimaryTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([YeePrimaryTableViewCell class])];
    }
    [cell setBackgroundColor:xBackgroundColor];
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
    
}
-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView *view=[[UIView alloc] initWithFrame:CGRectMake(0, 0, kMainScreenWidth, 0.01)];
    return view;
}
-(UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    UIView *view=[[UIView alloc] initWithFrame:CGRectMake(0, 0, kMainScreenWidth, 2.0f)];
    [view setBackgroundColor:[UIColor whiteColor]];
    return view;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 0.01;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 2.0;
}


@end
